<template>
  <div class="app-container">
    <el-dialog title="学员协议" :visible.sync="thistype" @close="fun(tname)"> 
        <div  style="width:400px;height:100px;border:1px dashed #ccc;position: relative;">
            <el-image 
                style="width: 100px; height: 400px;
                transform:rotate(-90deg);
                position:absolute;
                top: -150px;
                left: 150px;"
                :src="queryParams.signProtocolPath" 
            > 
            <div slot="error"  style="width: 200px; height: 400px;transform:rotate(90deg);
                position:absolute;
                top: -100px;
                left: -200px;"
            >
                    该学员暂未签订协议
            </div>
            </el-image>
        </div>
        <div slot="footer" class="dialog-footer">
        <!-- <el-button @click="handleDelete" >确 定</el-button> -->
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {  getProtpcpl, delProtpcpl } from "@/api/system/protpcpl";
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/system/info";

import {Bus} from '@/utils/bus'

export default {
  props: ['type', 'fun', 'tname', 'tablerow'],
  name: "Protpcpl",
  data() {
    return {
      thistype: this.type, // 模态框状态
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id:null,//签署协议id
        studentId: this.id,//学员id
        protocolId: null,//协议id
        signProtocolPath: null,//签属协议路径
        signNameId: null,//学员签名id
        signTime: null,
        isDetele: null,
        createDate: null
      },
      // 表单参数
      form: {},
    };
  },
  created() {
     this.getList();
  },
  methods: {
    /** 查询学员签署协议列表 */
    getList() {
        Bus.$on('sendid',data=>{
            getProtpcpl(data).then(res=>{
                this.queryParams.signProtocolPath = process.env.VUE_APP_BASE_API + res.data.signProtocolPath
                this.queryParams.studentId = res.data.studentId
            })
        })
    },
    /** 删除当前协议操作 */
    handleDelete(row) {
      /* const stuid = this.queryParams.studentId
      this.$confirm('是否确认删除学员id为"' + stuid + '"的协议?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delProtpcpl(stuid);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {}); */
    },
    // 取消按钮
    cancel() {
      this.thistype = false;
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
  },
  watch: {
    type () {
      this.thistype = this.type
    }
  }
};
</script>
